Time correlated data such as sounds, images, speech, etc. are by their nature analog (i.e. continuous). However, computers are, for the most part, digital (i.e. discrete). In order for a digital computer to process analog signals, the analog signals are first converted into digital signals which represent the analog signals. This is accomplished by repeatedly sampling the analog signals in short time intervals and converting each sampled value into a digital value. The resulting digital signal is then processed by the digital computer. The processing of such digitized signals by a computer is known as digital signal processing.
For real-time digital signal processing, the computer accepts and processes incoming samples at the average rate that the samples are being generated by an input process, and produce outgoing signals at the average consumption rate of an output process. One method for accomplishing this is to wait for an input sample. Once the sample is received, it is processed and then outputted. In other words, single samples are processed one at a time.
A more efficient digital signal processing method involves buffering input samples so that processing can be effected on groups of samples rather than just individual samples. Such an approach is known as frame-based processing. FIG. 1 is a diagram of frame-based processing. The basic idea behind frame-based processing is to slice time into short periods, known as frames, within which all the required data processing for that frame is completed. Digitized signals are divided into groups which represent the same amount of time as a frame. For example, Compact Disc audio data runs at a rate of 44, 100 samples per second. Given a frame rate of 10 milliseconds (100 frames per second), there would be 441 samples per frame. During each frame, the required program code executes on the collected input samples, and the resulting out-put data is dumped into an out-put buffer. FIG. 2 shows an example of frame buffering.
Thereby, frame-based processing reduces the task switching overhead when multiple tasks are being run. For example, given four tasks and a rate of 100 samples per frame, frame-based processing allows for switching between the tasks four times rather than 400 times per frame. The drawback of frame-based processing is increased latency. For sample-at-a-time processing, one sample delay between input and output is incurred. For flame-based processing, the latency increases to two frames. For applications where this is not an issue, frame-based processing is advantageous.
The throughput of the frame-based processing system can be increased by adding additional slave processors for processing in parallel with the master processor. However, the frames of the additional processors should be synchronized with respect to each other along with the frames of the master processors. The reason why synchronization is important is so that data can be streamed between the multiple processors. If the frames of several processors are based on different clock sources, they will drift relative to each other over a period of time.
FIGS. 3a and 3b show synchronized and unsynchronized frames, respectively. Passing frames of data between two processors having unsynchronized frames results in periodically having one too many frames or not having an available frame when one is needed. An extra frame contains extra data and must be dropped, while a missing frame requires replication. Unless some other action is taken, a disruption will result in audio or telecommunication applications. Also, unacceptable data loss will result for data communication applications. Thus, in order to effectively pass frames of data between different processors, the frames on the multiple processors should be synchronized.
One prior art method for synchronizing the frames is to hardwire a common clock to all the processors. Thereby, the frames of each processor are being processed at the same time in reference to the common clock. A disadvantage to this synchronization method is that running additional wires to make the clock connections may cause serious electro-magnetic interference (EMI) problems. Another disadvantage is that it is difficult to expand such a system (i.e. add more processors) because the common clock must be bused to any additional processors. Yet, another disadvantage is that the additional clock wires take up room on a printed circuit board. If there is no common clock or frame synchronization signal between processors in hardware, accurate crystals must be used as clock sources for each processor.
However, these clocks are not precise enough to achieve processor frame synchronization. Typical crystal clock tolerances will allow frames to be synchronous to within .+-.0.01%. While .+-.0.01% seems to be very precise, this small imprecision is, nevertheless, unacceptable. For example, the number of frame for a 100% error is calculated by dividing the frame time by the frame time error. Assuming a 10 millisecond frame time (i.e. 100 frames per second) and assuming that both crystal clocks are at the extreme opposite ends of their tolerances, the number of frames for a 100% error would be: EQU 10 ms/(2.times.0.01% of 10 ms)=10 ms/2 .mu.s=5000
According to the above calculations, a .+-.0.01% crystal clock tolerance results in totally unsynchronized frames every 5000 frames, in a worst case situation. At 100 frames per second, a full frame with either be dropped or an extra frame will be generated every 50 seconds.
Another problem with real-time frame-based processing between digital signal processors is that of synchronizing I/O data streams with the frames. Even though the frames of the slave processors are synchronous with the frames of a master processor, this does not guarantee that the input and output data streams being processed are synchronized with the frames.
Therefore, what is needed is an apparatus and method for synchronizing the frames of slave processors with the frames of a master processor, which can also be used to effectively synchronize input and output data streams with the frames.